//
//  NoticeMainViewController.swift
//  ModernFoodWebsite
//
//  Created by apple on 16/5/30.
//  Copyright © 2016年 Lonnie. All rights reserved.
//

import UIKit

class NoticeMainViewController: BaseTableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.rowHeight = 157
        tableView.registerClass(NoticeMainCell.classForCoder(), forCellReuseIdentifier: "notice")
        title = ""
    }
    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        self.navigationController?.navigationBarHidden = true
        self.navigationController?.hidesBarsOnSwipe = false
    }
    
    override func viewWillDisappear(animated: Bool) {
        super.viewWillDisappear(animated)
        self.navigationController?.navigationBarHidden = false
        self.navigationController?.hidesBarsOnSwipe = true
    }
    
    override func prefersStatusBarHidden() -> Bool {
        return true
    }

}
extension NoticeMainViewController {
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 4
    }
    
    override func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
        tableView.deselectRowAtIndexPath(indexPath, animated: true)
        performSegueWithIdentifier("list", sender: nil)
    }
    
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("notice") as! NoticeMainCell
        cell.button.setTitle(["人才招聘","产品供应","产品求购","招商公告"][indexPath.row], forState: .Normal)
        cell.contentImageView.image = UIImage(named:"information_pic\(indexPath.row+1)")
        cell.selectionStyle = .None
        return cell
    }
}